package com.leonzhangxf.ioc.injection.method;

import lombok.Getter;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * A hello world command which {@link Command#exec()} method only print the message.
 *
 * @author leonzhangxf
 */
@Component
@Scope("prototype")
public class HelloWorldCommand implements Command {

    @Getter
    private String message;

    @Override
    public void setMessage(String message) {
        this.message = message;
    }

    @Override
    public Object exec() {
        System.out.println(String.format("The exec message is %s.", message));
        return message;
    }
}
